<!DOCTYPE html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adicionar Lugar</title>
<link rel="stylesheet" href="<c:url value='/css/estilos.css'/>" />
<script src="<c:url value='/js/jquery.js'/>"></script>
<script src="<c:url value='/js/maps.js'/>"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBUrjPSljSm__J8ddybnWbWDazgPTyvc_I&sensor=false"></script> 
<script type="text/javascript">
	function validations() {

		if ("" == document.forms.placeForm.placeCode.value
				|| "" == document.forms.placeForm.placeName.value
				|| "" == document.forms.placeForm.room.value
				|| "" == document.forms.placeForm.block.value
				|| "" == document.forms.placeForm.longitudeString.value
				|| "" == document.forms.placeForm.latitudeString.value) {
			alert("Complete los campos requeridos");
			return false;
		}

		return true;
	}
</script>

</head>
<body>
	<header> <jsp:include page="items.jsp"></jsp:include> </header>
	<h1>Crear Nuevo Lugar</h1>
	<section> <c:url var="saveUrl" value="/place/add" /> <form:form
		name="placeForm" modelAttribute="placeAttribute" method="POST"
		action="${saveUrl}" onsubmit="return validations();">
		<table>
			<tr>
				<td><form:label path="placeCode">C&oacutedigo:</form:label></td>
				<td><form:input path="placeCode" id="placeCode" /></td>
			</tr>
			<tr>
				<td><form:label path="placeName">Nombre:</form:label></td>
				<td><form:input path="placeName" id="placeName" /></td>
			</tr>
			<tr>
				<td><form:label path="placeDescription">Descripci&oacuten:</form:label></td>
				<td><form:textarea path="placeDescription"
						id="placeDescription" /></td>
			</tr>
			<tr>
				<td><form:label path="room">Aula:</form:label></td>
				<td><form:input path="room" id="room" /></td>
			</tr>
			<tr>
				<td><form:label path="block">Bloque:</form:label></td>
				<td><form:input path="block" id="block" /></td>
			</tr>
			<tr>
				<td><form:label path="placeType">Tipo de Lugar:</form:label></td>
				<td><form:select path="placeType" id="placeType">
						<form:options items="${placeTypeList}" itemLabel="name"
							itemValue="code" />
					</form:select></td>
			</tr>
			<tr>
				<td><form:label path="longitudeString">Longitud:</form:label></td>
				<td><form:input path="longitudeString" id="longitudeString" /></td>
			</tr>
			<tr>
				<td><form:label path="latitudeString">Latitud:</form:label></td>
				<td><form:input path="latitudeString" id="latitudeString" /></td>
			</tr>

		</table>

		<input type="submit" value="Guardar" />
	</form:form>
	<div id="mapa_canvas"  style="width: 710px; height: 600px; border: 4px solid #FF6600;">
		
	</div>
	<section>
</body>
</html>